<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="__UI__/css/bs3/dpl.css" rel="stylesheet" type="text/css" />
<link href="__UI__/css/bs3/bui.css" rel="stylesheet" type="text/css" />
<link href="__UI__/css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
button {
	margin-right:20px;
}
</style>
<script type="text/javascript" src="__UI__/js/jquery-1.8.1.min.js"></script>
</head>
<body>
<div class="demo-content" style="margin-top:1%;">
    <div class="row" style="margin-left:10px;">
        <form id="J_Form" action="{:U('Member/edit')}" class="form-horizontal registerform" method="post" enctype="multipart/form-data">
        	<div id="tab" style="margin-left:1%; padding-bottom:20px; padding-top:20px;"></div>
            <div id="panel" class="" style="padding:10px;">
                <input name="id" type="hidden" value="{$info.id}" />
                <div class="row">
					<div class="control-group span12">
                        <label class="control-label"><s>*</s>用户昵称</label>
                        <div class="controls">
                            <input type="text" name="nickname" id="nickname" class="input-large" datatype="*" nullmsg="请输入用户昵称！" ajaxurl="{:U('Member/nickname',array('id'=>$info[id]))}" sucmsg="此用户昵称可注册" data-tip="{text:'请输入用户昵称'}" value="{$info.nickname}" />
                        </div>
                    </div>
                    <div class="control-group span12">
                        <label class="control-label"><s>*</s>用户名称</label>
                        <div class="controls">
                            <input type="text" name="username" id="username" class="input-large" datatype="*" nullmsg="请输入用户名称！" ajaxurl="{:U('Member/checkname',array('id'=>$info[id]))}" sucmsg="此用户名称可注册" data-tip="{text:'请输入用户名称'}" value="{$info.username}" />
                        </div>
                    </div>
                </div>
                
                <div class="row">
					<div class="control-group span12">
                        <label class="control-label"><s>*</s>公司名称</label>
                        <div class="controls">
                            <input type="text" name="company" id="company" class="input-large" datatype="*" nullmsg="请输入公司名称！" ajaxurl="{:U('Member/checkcom',array('id'=>$info[id]))}" sucmsg="此公司名称可注册" data-tip="{text:'请输入公司名称'}" value="{$info.company}"  />
                        </div>
                    </div>
                    <div class="control-group span12">
                        <div class="control-group">
                            <label class="control-label"><s>*</s>开始时间</label>
                            <div class="controls">
                                <input type="text" class="calendar" name="start_time" value="{$info.start_time|date='Y-m-d',###}" />
                            </div>
                            <label class="control-label"><s>*</s>结束时间</label>
                            <div class="controls">
                                <input type="text" class="calendar" name="end_time" value="{$info.end_time|date='Y-m-d',###}" />
                            </div>
                        </div>
                    </div>
 				</div>
<script type="text/javascript">
	$(document).ready(function() {
		$.ajax({
			type: "get",
			url: "{:U('Member/city')}",
			data: {"parent_id": "1", "type": "1"},
			dataType: "json",
			success: function(data) {
				$("#provinces").html("<option value='{$provinces.region_id}' selected>{$provinces.region_name}</option><option value=''>请选择省份</option>");
				$.each(data, function(i, item) {
					$("#provinces").append("<option value='" + item.region_id + "'>" + item.region_name + "</option>");
				});
			}
		});

		$("#provinces").change(function() {
			$.ajax({
				type: "get",
				url: "{:U('Member/city')}",
				data: {"parent_id": $(this).val(), "type": "2"},
				dataType: "json",
				success: function(data) {
					$("#citys").html("<option value=''>请选择市</option>");
					$.each(data, function(i, item) {
						$("#citys").append("<option value='" + item.region_id + "'>" + item.region_name + "</option>");
					});
				}
			});
		});

		$("#citys").change(function() {
			$.ajax({
				type: "get",
				url: "{:U('Member/city')}",
				data: {"parent_id": $(this).val(), "type": "3"},
				dataType: "json",
				success: function(data) {
					$("#countys").html("<option value=''>请选择县</option>");
					$.each(data, function(i, item) {
						$("#countys").append("<option value='" + item.region_id + "'>" + item.region_name + "</option>");
					});
				}
			});
		});
	});
</script>
				<div class="control-group">
					<label class="control-label"><s></s>所在地区</label>
					<div class="controls">
						<select id="provinces" name="provinces">
                        	<option value='{$provinces.region_id}' selected>{$provinces.region_name}</option>
							<option value="">请选择省份</option>
						</select>&nbsp;&nbsp;
						<select id="citys" name="citys">
                        	<option value="{$citys.region_id}" selected>{$citys.region_name}</option>
                            <option value="">请选择市</option>
						</select>&nbsp;&nbsp;
                        <select id="countys" name="countys">
                        	<option value="{$countys.region_id}" selected>{$countys.region_name}</option>
							<option value="">请选择县</option>
						</select>
					</div>
				</div>
                         
				<div class="row actions-bar">
                	<span id="msgdemo2"></span>
                    <div class="form-actions span13 offset3">
                        <button type="submit" class="button button-primary">保存</button>
                        <button type="reset" class="button">重置</button>
                        <button type="button" class="button button-info" name="backid" id="backid">返回</button>
                    </div>
            	</div>           
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="__UI__/js/jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="__UI__/js/bui.js"></script>
<script type="text/javascript" src="__UI__/js/config.js"></script>
<script type="text/javascript" src="__UI__/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">
	$(function () {       
		$('#backid').click(function(){
			top.topManager.openPage({
				id:'member{:I("get.gid")}',
				<if condition="I('get.gid') eq 1">
				title:'普通用户',
				</if>
				<if condition="I('get.gid') eq 2">
				title:'监管用户',
				</if>
				href:'{:U("Member/index", array("gid"=>I("get.gid")))}',
				isClose:true,
				reload:true,
			});
		 });
    });
	top.topManager.closePage('member');
	top.topManager.closePage('member_add');
	top.topManager.closePage('member_repwd');
    BUI.use(['bui/tab','bui/mask'],function(Tab){
        var tab = new Tab.TabPanel({
            render:'#tab',
            elCls:'nav-tabs',
            panelContainer:'#panel',
            autoRender:true,
            children:[
                {title:'基本信息',value:'1',selected:true},
            ]
        });
    });
    BUI.use('bui/form', function (Form) {
        new Form.Form({
            srcNode:'#J_Form'
        }).render();
    });

	$(function(){
		$(".registerform").Validform({
			tiptype:function(msg,o,cssctl){
				var objtip=$("#msgdemo2");
				cssctl(objtip,o.type);
				objtip.text(msg);
			},
			ajaxPost:true,
			callback:function(data){
				if(data.status == 'y'){
					top.topManager.openPage({
						id:'member{:I("get.gid")}',
						<if condition="I('get.gid') eq 1">
						title:'普通用户',
						</if>
						<if condition="I('get.gid') eq 2">
						title:'监管用户',
						</if>
						href:'{:U("Member/index", array("gid"=>I("get.gid")))}',
						isClose:true,
						reload:true,
					});
				}
			},
		});
	})
</script>
</body>
</html>